package com.springBoot.springBootSysCore.common.third.sms;
import com.springBoot.springBootSysCore.common.utils.encoding.Encodes;
import com.springBoot.springBootSysCore.common.utils.http.HttpsRequest;

import net.sf.json.JSONObject;

/**
 * 华信短信
 * @author Administrator
 *
 */
public class HuaXinSms {
	
	private static final String SIGNATURE = "测试";
	
	private static final String ACCOUNT = "";
	private static final String PASSWORD = "***";
	

	public static void main(String[] args) throws Exception {
		System.out.println(sendSMS("13881865038", "55555"));;
	}
	
	/**
	 * 发送短信
	 * @return 
	 * @throws Exception
	 */
	public static String sendSMS(String phones,String content)throws Exception {
		String url = "https://dx.ipyy.net/smsJson.aspx";
		String param = "action=send&userid=&account="+ACCOUNT+"&password="
				+ Encodes.getMD5Str(PASSWORD)+"&mobile="+phones+"&content=【"+SIGNATURE+"】亲爱的用户，您的短信验证码为"+content+",30分钟内有效，若非本人操作请忽略。&sendTime=&extno=";
		JSONObject js = JSONObject.fromObject(HttpsRequest.post(url, param,"UTF-8"));
		return js.getString("returnstatus");
	}
	
}
